package org.ccams.dao;

import java.util.List;


import org.ccams.domain.TSalesChannel;
import org.ccams.util.PageParameter;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class TSalesChannelDAO extends SqlMapClientDaoSupport{

    public TSalesChannelDAO() {
        super();
    }

    public int insert(TSalesChannel record) {
       return  (Integer)getSqlMapClientTemplate().update("t_sales_channel.abatorgenerated_insert", record);
    }

    public int updateByPrimaryKey(TSalesChannel record) {
        int rows = getSqlMapClientTemplate().update("t_sales_channel.abatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

 
    public int updateByPrimaryKeySelective(TSalesChannel record) {
        int rows = getSqlMapClientTemplate().update("t_sales_channel.abatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    public TSalesChannel selectByPrimaryKey(Long salesChannelCode) {
        TSalesChannel key = new TSalesChannel();
        key.setSalesChannelCode(salesChannelCode);
        TSalesChannel record = (TSalesChannel) getSqlMapClientTemplate().queryForObject("t_sales_channel.abatorgenerated_selectByPrimaryKey", key);
        return record;
    }

 
    public int deleteByPrimaryKey(Long salesChannelCode) {
        TSalesChannel key = new TSalesChannel();
        key.setSalesChannelCode(salesChannelCode);
        int rows = getSqlMapClientTemplate().delete("t_sales_channel.abatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }
    /**
	 * 返回指定页码的角色
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "deprecation" })
	public  List<TSalesChannel> getTSalesChannel(PageParameter pageParmeter){		
		return getSqlMapClientTemplate().queryForList("t_sales_channel.getByPage", pageParmeter);
	}
	/**
	 * 返回记录总数
	 * @return
	 */
	public int getCount(){
		return (Integer)getSqlMapClientTemplate().queryForObject("t_sales_channel.getCount");
	}
	/**
	 * 返回所有
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public  List<TSalesChannel> getAll(){		
		return getSqlMapClientTemplate().queryForList("t_sales_channel.getAll");
	}
}